//
//  LRNoCommentCell.swift
//  LRWeibo
//
//  Created by 雷路荣 on 15/12/26.
//  Copyright © 2015年 leilurong. All rights reserved.
//

/**
*  暂无评论cell 用于显示暂无评论标签
*/
import UIKit

class LRNoCommentCell: UITableViewCell {

    //消息文本
    var message: String? {
        didSet{
        messageLabel.text = message
        }
    }
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    override init(style: UITableViewCellStyle, reuseIdentifier: String?) {
        super.init(style: style, reuseIdentifier: reuseIdentifier)
        
        contentView.addSubview(messageLabel)
        // 添加约束
        messageLabel.translatesAutoresizingMaskIntoConstraints = false
        //设置水平约束左右与屏幕间距为0
        contentView.addConstraints(NSLayoutConstraint.constraintsWithVisualFormat("H:|-0-[ml]-0-|", options: NSLayoutFormatOptions(rawValue: 0), metrics: nil, views: ["ml": messageLabel]))
        //设置垂直约束 设置上下间距0，高度98
        contentView.addConstraints(NSLayoutConstraint.constraintsWithVisualFormat("V:|-0-[ml(98)]-0-|", options: NSLayoutFormatOptions(rawValue: 0), metrics: nil, views: ["ml": messageLabel]))
        
    }

    //懒加载
    private lazy var messageLabel: UILabel = {
        let label = UILabel(fontSize: 18, textColor: UIColor.lightGrayColor())
        label.textAlignment = NSTextAlignment.Center
        label.backgroundColor = UIColor.whiteColor()
        return label
    }()
}
